﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TestCRFEncoder
{
    class Program
    {
        static void Main(string[] args)
        {
            CRFEncoder.Encoder encoder = new CRFEncoder.Encoder();
            int max_iter = 100;
            int min_feature_freq = 1;
            float min_diff = 0.0001f;
            int threads_num = 3;
            string strTemplate = "template.1";
            string strTrainingCorpus = "ner.train";
            string strModel = "ner.model";


            if (args.Length < 3)
            {
                Console.WriteLine("TestCRFEncoder [Template filename] [Training filename] [Model filename] [Maximum iteration] [Minimum feature frequency] [Minimum diff value] [Threads used to train model]");
                Console.WriteLine("[Maximum Iteration] default value is 1000");
                Console.WriteLine("[Minimum feature frequency] default value is 2");
                Console.WriteLine("[Minimum diff value] default value is 0.0001");
                Console.WriteLine("[Threads used to train model] default value is 1");

                return;
            }

            strTemplate = args[0];
            strTrainingCorpus = args[1];
            strModel = args[2];

            if (args.Length >= 4)
            {
                max_iter = int.Parse(args[3]);
            }
            if (args.Length >= 5)
            {
                min_feature_freq = int.Parse(args[4]);
            }
            if (args.Length >= 6)
            {
                min_diff = float.Parse(args[5]);
            }
            if (args.Length >= 7)
            {
                threads_num = int.Parse(args[6]);
            }
            

            encoder.learn(strTemplate, strTrainingCorpus, strModel, max_iter, min_feature_freq, min_diff, 1, threads_num);
        }
    }
}
